#ifndef LOCKFILE_H_
#define LOCKFILE_H_

#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <iostream>

using namespace std;

class FileLocker {

private:

	struct flock fl;
	int fd;
	char name [ 255 ];

public:

	FileLocker ( char* name );
	virtual ~FileLocker();

	int getLock ();
	int releaseLock ();
	int writeToFile ( char* buffer,int buffsize );
	string readFromFile ( int* currentPosition );
	int getFileSize();
};

#endif /* LOCKFILE_H_ */
